package cn.lxh.remote.fallback;

import cn.lxh.remote.api.BigdataFeignApi;
import cn.lxh.remote.pojo.bo.DriverPointBo;
import cn.lxh.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lxh Create Time: 2023/12/23 17:05
 * BigdataFeignApiFallbackFactory熔断降级处理方案类
 */
@Component
public class BigdataFeignApiFallbackFactory implements FallbackFactory<BigdataFeignApi> {
    @Override
    public BigdataFeignApi create(Throwable cause) {
        return new BigdataFeignApi() {
            @Override
            public JSONResult<List<DriverPointBo>> driverPointList(String orderNo) {
                cause.printStackTrace();
                return JSONResult.error("服务调用失败");
            }
        };
    }
}
